package com.eugene.ui.viewerfilter;

import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

import com.eugene.element.FnCalendar;
import com.eugene.entity.CommonEntity;

public class BaseDateFilter extends ViewerFilter {
	private String searchDate;
//	private FnCalendar searchDate;

	public void setSearchDate(String s) {
		// Search must be a substring of the existing value
		this.searchDate = ".*" + s + ".*";
	}
	@Override
	public boolean select(Viewer viewer, Object parentElement, Object element) {
		if (searchDate == null || searchDate.length() == 0) {
			return true;
		}
		CommonEntity irCurve = (CommonEntity) element;
//		if (irCurve.getEtyId().matches(searchDate)) {
//			return true;
//		}
		if(irCurve.getBaseDate().toString().matches(searchDate)){
			return true;
		}


		return false;

	}

}
